var	main = {
	Name: 'main',
	Version: '1.7.1_beta3',
	require: function(libraryName)
	{
		document.write('<script	type="text/javascript" src="'+libraryName+'"></script>');
	},
	REQUIRED_PROTOTYPE:	'1.5.1',

	load: function() 
	{
		function convertVersionString(versionString)
		{
			var	r =	versionString.split('.');
			return parseInt(r[0])*100000 + parseInt(r[1])*1000 + parseInt(r[2]);
		}
 
		if((typeof Prototype=='undefined') || 
			 (typeof Element ==	'undefined') ||	
			 (typeof Element.Methods=='undefined') ||
			 (convertVersionString(Prototype.Version) <	
				convertVersionString(main.REQUIRED_PROTOTYPE)))
			 throw("requires the Prototype JavaScript framework	>= " +
				main.REQUIRED_PROTOTYPE);
		
		$A(document.getElementsByTagName("script")).findAll( function(s) {
			return (s.src && s.src.match(/main\.js(\?.*)?$/))
		}).each( function(s) {
			var	path = s.src.replace(/main\.js(\?.*)?$/,'');
			var	includes = s.src.match(/\?.*load=([a-z,]*)/);
			(includes ?	includes[1]	: 'config,func,builder,effects,controls,dragdrop,Message,DAjax,LightBox,Tpl,sql,Page,Tabs,Validator,Cache,DHistory,Accordion,Sound,Debug').split(',').each(
			 function(include) { main.require(path+include+'.js') });
		});
	}
}

main.load();